package com.maidou.qiantai.service.impl;

import java.util.ArrayList;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.maidou.qiantai.mapper.SpuCommentImageMapper;
import com.maidou.qiantai.domain.SpuCommentImage;
import com.maidou.qiantai.service.ISpuCommentImageService;

/**
 * 商品评论图集Service业务层处理
 * 
 * @author maidou
 * @date 2024-03-13
 */
@Service
public class SpuCommentImageServiceImpl implements ISpuCommentImageService 
{
    @Autowired
    private SpuCommentImageMapper spuCommentImageMapper;

    /**
     * 查询商品评论图集
     * 
     * @param id 商品评论图集主键
     * @return 商品评论图集
     */
    @Override
    public SpuCommentImage selectSpuCommentImageById(Long id)
    {
        return spuCommentImageMapper.selectSpuCommentImageById(id);
    }

    /**
     * 查询商品评论图集列表
     * 
     * @param spuCommentImage 商品评论图集
     * @return 商品评论图集
     */
    @Override
    public List<SpuCommentImage> selectSpuCommentImageList(SpuCommentImage spuCommentImage)
    {
        return spuCommentImageMapper.selectSpuCommentImageList(spuCommentImage);
    }

    /**
     * 新增商品评论图集
     * 
     * @param spuCommentImage 商品评论图集
     * @return 结果
     */
    @Override
    public int insertSpuCommentImage(SpuCommentImage spuCommentImage)
    {
        spuCommentImage.setCreateTime(DateUtils.getNowDate());
        return spuCommentImageMapper.insertSpuCommentImage(spuCommentImage);
    }

    /**
     * 修改商品评论图集
     * 
     * @param spuCommentImage 商品评论图集
     * @return 结果
     */
    @Override
    public int updateSpuCommentImage(SpuCommentImage spuCommentImage)
    {
        spuCommentImage.setUpdateTime(DateUtils.getNowDate());
        return spuCommentImageMapper.updateSpuCommentImage(spuCommentImage);
    }

    /**
     * 批量删除商品评论图集
     * 
     * @param ids 需要删除的商品评论图集主键
     * @return 结果
     */
    @Override
    public int deleteSpuCommentImageByIds(Long[] ids)
    {
        return spuCommentImageMapper.deleteSpuCommentImageByIds(ids);
    }

    /**
     * 删除商品评论图集信息
     * 
     * @param id 商品评论图集主键
     * @return 结果
     */
    @Override
    public int deleteSpuCommentImageById(Long id)
    {
        return spuCommentImageMapper.deleteSpuCommentImageById(id);
    }

    @Override
    public List<SpuCommentImage> selectSpuCommentImageByIdBatch(List<Long> longs) {
        if (longs==null){
            return new ArrayList<>();
        }
        if (longs.size()==0){
            return new ArrayList<>();
        }
        return spuCommentImageMapper.selectSpuCommentImageByIdBatch(longs);
    }
}
